{
	name:"PathRotate",
	onFocusIn(){
		this.longToast("请先选择旋转中心，然后选择目标路径")
	},
	onFocusOut(){
		this.clearRect()
		this.path = null
		//旋转中心
		this.rp = null
		// 开始旋转控制点和旋转中心的角度
		this.sa = 0
		this.ghostCtx.pathMode=false
	},
	onClick(pos,e,meta){
		// rotatePos
		if(!this.rp){
			this.rp = this.newPoint(pos,false)
			this.hpoint(this.rp)
			this.toast("请再选择目标路径")
			return
		}
		if(Math.distance(this.rp,pos)<this.rp.r){
			this.rp = null
			this.clearRect()
			return
		}
		if(!this.path)
			this.toast("请再选择目标路径")
	},
	onMousedown(pos){
		if(!this.rp)return
		let rp = this.rp
		let path = this.$version.queryInPath(pos).filter(ph=>!this.ActionGroup.noRotate.includes(ph.action))[0]
		if(!path)return
		this.ghostCtx.pathMode=true
		path = this.path = this.loadMngByAction(path.action).getRotateMeta(path)
		this.sa = Math.tan360(pos.y-rp.y,pos.x-rp.x)
		this.hpath(path)
	},
	onMouseup(pos){
		if(!this.rp)return
		if(!this.path)return
		let path = this.path
		this.$version.update({
			action:path.action,
			step:this.createData(pos),
			state:path.state
		},path.id)
		this.clearRect()
		this.hpoint(this.rp)
		this.sa = 0
		this.ghostCtx.pathMode=false
		setTimeout(()=>{
			this.path = null
		},100)
	},
	onMousemove(pos){
		this.clearRect()
		this.rp&&this.hpoint(this.rp)
		let path = this.path
		if(!path)return
		this.hpath({
			action:path.action,
			step:this.createData(pos),
			state:path.state
		})
	},
	createData(pos){
		let rp = this.rp
		let path = this.path

		let a = Math.tan360(pos.y-rp.y,pos.x-rp.x)- this.sa
		return path.step.clone().map(sp=>{
			let {x,y} = Math.rotatePos(sp,rp,a)
			sp.x = x
			sp.y = y
			return sp
		})
	}
}